﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CorpAbreu.Common.BaseClasses;
using System.ComponentModel;
using Microsoft.Practices.Prism.Events;
using CorpAbreu.Common;

namespace StatusBarModule.ViewModels
{
    public class StatusBarViewModel : ViewModelBase
    {
        private readonly IEventAggregator _eventAggregator;

        public StatusBarViewModel(IEventAggregator eventAggregator)
        {
            this._eventAggregator = eventAggregator;
            this._eventAggregator.GetEvent<TesteSelectedEvent>().Subscribe(TesteSelected, true);
        }

        private string _Texto;
        public string Texto
        {
            get { return _Texto; }
            set
            {
                if (value != _Texto)
                {
                    _Texto = value;
                    OnPropertyChanged("Texto");
                }
            }
        }


        private void TesteSelected(string id)
        {
            if (!string.IsNullOrEmpty(id))
            {
                Texto = id;
                base.OnPropertyChanged("Texto");
            }
        }
    }
}
